package com.example.demo.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class HelloAop {
    @Pointcut(value = "@annotation(com.example.demo.aop.HelloAnnotation)")
    public void aop () {
    }
    @Around(value = "aop() && @annotation(helloAnnotation) ")
    public Object around (ProceedingJoinPoint joinPoint, HelloAnnotation helloAnnotation) {
        System.out.println("around");
        try {
            return joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return null;
    }

}
